package view;

import java.awt.Dimension;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;

import controller.AddEmpController;
import controller.ChangePassEmpController;
import controller.ViewEmpController;

public class MenuEmployeePanel extends JPanel {

	private static final long serialVersionUID = 1L;
	private JButton btnAddEm;
	private JButton btnChangePassEm;
	private JButton btnViewEm;
	private JToolBar toolbarEmployee;
	
	private Home home;

	public MenuEmployeePanel(Home home) {
		this.home = home;
		initComponents();
		btnViewEm.setPreferredSize(new Dimension(150, 65));
		btnAddEm.setPreferredSize(new Dimension(150, 65));
		btnChangePassEm.setPreferredSize(new Dimension(150, 65));
		
		controller();
	}

	private void initComponents() {

		toolbarEmployee = new JToolBar();
		btnViewEm = new JButton();
		btnAddEm = new JButton();
		btnChangePassEm = new JButton();

		setBackground(new java.awt.Color(255, 255, 255));
		setLayout(null);

		toolbarEmployee.setFloatable(false);
		toolbarEmployee.setOrientation(SwingConstants.VERTICAL);
		toolbarEmployee.setOpaque(false);

		btnViewEm.setFont(new java.awt.Font("Calibri", 1, 18));
		btnViewEm.setIcon(new ImageIcon("icon/viewEmp.png"));
		btnViewEm.setText("View Employee");
		btnViewEm.setFocusable(false);
		btnViewEm.setHorizontalTextPosition(SwingConstants.CENTER);
		btnViewEm.setMargin(new java.awt.Insets(2, 11, 2, 14));
		btnViewEm.setOpaque(false);
		btnViewEm.setPreferredSize(new java.awt.Dimension(140, 65));
		btnViewEm.setVerticalTextPosition(SwingConstants.BOTTOM);
		btnViewEm.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btViewEmActionPerformed(evt);
			}
		});
		toolbarEmployee.add(btnViewEm);

		btnAddEm.setFont(new java.awt.Font("Calibri", 1, 18));
		btnAddEm.setIcon(new ImageIcon("icon/addEmp.png"));
		btnAddEm.setText("  Add  Employee ");
		btnAddEm.setFocusable(false);
		btnAddEm.setHorizontalTextPosition(SwingConstants.CENTER);
		btnAddEm.setOpaque(false);
		btnAddEm.setPreferredSize(new java.awt.Dimension(140, 65));
		btnAddEm.setVerticalAlignment(SwingConstants.BOTTOM);
		btnAddEm.setVerticalTextPosition(SwingConstants.BOTTOM);
		btnAddEm.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btAddEmActionPerformed(evt);
			}
		});
		toolbarEmployee.add(btnAddEm);

		btnChangePassEm.setFont(new java.awt.Font("Calibri", 1, 18));
		btnChangePassEm.setIcon(new ImageIcon("icon/change.png"));
		btnChangePassEm.setText("Change Password");
		btnChangePassEm.setFocusable(false);
		btnChangePassEm.setHorizontalTextPosition(SwingConstants.CENTER);
		btnChangePassEm.setOpaque(false);
		btnChangePassEm.setPreferredSize(new java.awt.Dimension(140, 65));
		btnChangePassEm.setVerticalTextPosition(SwingConstants.BOTTOM);
		toolbarEmployee.add(btnChangePassEm);

		add(toolbarEmployee);
		toolbarEmployee.setBounds(30, 70, 150, 200);
	}

	private void btViewEmActionPerformed(java.awt.event.ActionEvent evt) {
	}

	private void btAddEmActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btAddEmActionPerformed
	}

	
	private void controller(){
		btnAddEm.addActionListener(new AddEmpController(home));
		btnViewEm.addActionListener(new ViewEmpController(home));
		btnChangePassEm.addActionListener(new ChangePassEmpController(home));
	}
}
